<script setup lang="ts">
import { useTitle } from '@/hooks/useTitle';
import img1 from '@/static/img/hp_shangji_icon.svg';
import img2 from '@/static/img/hp_tudijiaoyi_icon.svg';
import img3 from '@/static/img/hp_dituxiangmu_icon.svg';
import img4 from '@/static/img/hp_xiangmuyanzhen_icon.svg';
import img5 from '@/static/img/hp_jinrongfuwu _icon.svg';
import img6 from '@/static/img/hp_hangyezix_icon.svg';
import img7 from '@/static/img/hp_shangchengfuwu_icon.svg';
import img8 from '@/static/img/hp_huiketing_icon.svg';
import img9 from '@/static/img/hp_jifenchaoshi_icon.svg';
import img10 from '@/static/img/hp_quanbuyingy_icon.svg';

const { title, changeTitle } = useTitle();

const searchActive = ref(1);
const searchList = reactive([
  {
    id: 1,
    title: '搜商机'
  },
  {
    id: 2,
    title: '查公司'
  },
  {
    id: 3,
    title: '找关系'
  }
]);

const hotList = reactive([
  {
    title: '商机信息',
    img: img1
  },
  {
    title: '土地交易',
    img: img2
  },
  {
    title: '地图找项目',
    img: img3
  },
  {
    title: '项目验真',
    img: img4
  },
  {
    title: '金融服务',
    img: img5
  },
  {
    title: '行业咨询',
    img: img6
  },
  {
    title: '商城服务',
    img: img7
  },
  {
    title: '城市会客厅',
    img: img8
  },
  {
    title: '积分超市',
    img: img9
  },
  {
    title: '全部应用',
    img: img10
  }
]);

const cardList = reactive([
  {
    title: '生态环保',
    info: '汇鑫街道生态循环农业项目'
  },
  {
    title: '生态环保',
    info: '汇鑫街道生态循环农业项目'
  }
]);
</script>

<template>
  <view class="content">
    <view class="top-con">
      <view class="top-locat">
        <view class="top-locat-left">
          <view class="city">
            <view class="city-name">济南</view>
            <image class="city-icon" src="/static/img/hp_xiala_icon.svg" />
          </view>
          <view class="city-info">高温预警</view>
        </view>
        <view class="top-locat-right">
          <image class="img1" src="/static/img/hp_pc_icon.svg"></image>
          <image class="img2" src="/static/img/hp_huiyuan_icon.svg"></image>
        </view>
      </view>
      <image
        mode="widthFix"
        class="logo"
        src="/static/img/hp_logo_img.svg"
      ></image>
      <view class="search">
        <view
          v-for="item in searchList"
          :key="item.id"
          class="search-list"
          :class="{ active: item.id === searchActive }"
          @click="searchActive = item.id"
          >{{ item.title }}</view
        >
      </view>
      <view class="search-input">
        <image
          class="icon"
          mode="widthFix"
          src="/static/img/hp_search_icon.svg"
        ></image>
        <input
          class="input"
          type="text"
          placeholder="5千吨稻米仓储项目 12000万元"
        />
        <!-- <view class="right-icon"> -->
        <image
          class="icon"
          mode="widthFix"
          src="/static/img/hp_camera_icon.svg"
        ></image>
        <image
          class="icon"
          mode="widthFix"
          src="/static/img/hp_yuyin_icon.svg"
        ></image>
        <!-- </view> -->
      </view>
    </view>
    <view class="hot-con">
      <view class="hot-info">
        <view>全国项目总数量 1500个</view>
        <view>总投资 29430.32亿元</view>
      </view>
      <view class="hot-card">
        <view class="card-title">
          <view class="card-icon">
            <image
              class="img"
              mode="heightFix"
              src="/static/img/hp_resou_icon.svg"
            ></image>
          </view>
          <view class="card-desc">
            <view
              v-for="(item, index) in cardList"
              :key="index"
              class="card-desc-list"
            >
              <view class="card-desc-list-title">【{{ item.title }}】</view>
              <view class="card-desc-list-info">{{ item.info }}</view>
            </view>
          </view>
          <view class="card-btn">
            <img
              class="img"
              src="/static/img/hp_refresh_icon.svg"
              mode="widthFix"
              alt=""
            />
          </view>
        </view>
        <view class="card-info">
          <view v-for="(item, index) in hotList" :key="index" class="card-item">
            <image
              class="card-item-img"
              mode="widthFix"
              :src="item.img"
              alt=""
            ></image>
            <view class="card-item-title">{{ item.title }}</view>
          </view>
        </view>
      </view>
    </view>
    <view class="focus-con"></view>
  </view>
</template>

<style scoped lang="scss">
.p-10 {
  padding: 10px;
}
.content {
  background-color: #f5f8ff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.top-con {
  width: 100%;
  padding-top: 20px;
  // height: 241px;
  color: #fff;
  background: url('/static/img/hp_banner_img.svg') center no-repeat;
  background-color: #375cd6;
  background-position: 0 -18px;
  .top-locat {
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    .top-locat-left {
      .city {
        // color: #fff;
        display: flex;
        align-items: center;
        .city-name {
          font-size: 14px;
        }
        .city-icon {
          width: 12px;
          height: 12px;
        }
      }
      .city-info {
        font-size: 9px;
        opacity: 0.8;
      }
    }
    .top-locat-right {
      .img1 {
        width: 26px;
        height: 26px;
        padding-right: 10px;
      }
      .img2 {
        width: 76px;
        height: 26px;
      }
    }
  }
  .logo {
    margin-top: 22px;
    margin-bottom: 22px;
    padding-left: 52px;
    width: 290px;
    // height: 42px;
  }
  .search {
    display: flex;
    padding: 0 54px 0 52px;
    justify-content: space-between;
    .search-list {
      font-size: 16px;
      line-height: 26px;
      border-bottom: 2px solid transparent;
      transition: all 0.3s;
      &.active {
        border-bottom: 2px solid #fff;
      }
    }
  }
  .search-input {
    margin: 14px 10px 10px;
    height: 44px;
    padding: 0 8px;
    line-height: 44px;
    background: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    .icon {
      width: 24px;
      &:last-child {
        margin-left: 10px;
      }
    }
    .input {
      flex: 1;
      padding: 0 10px;
      height: 100%;
      line-height: 44px;
    }
  }
}
.hot-con {
  font-size: 14px;
  color: #fff;
  width: 100%;
  height: 282px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #375cd6 15%, #f5f8ff 50%);

  .hot-info {
    padding: 0 20px 10px;
    display: flex;
    justify-content: space-between;
  }
  .hot-card {
    margin: 0 10px;
    // height: 230px;
    .card-title {
      border-radius: 4px;
      background: linear-gradient(-45deg, #3761ff, #3188ff);
      height: 67px;
      padding: 0 10px;
      display: flex;
      align-items: center;
      .card-icon {
        height: 35px;
        border-right: 1px solid #fff;
        .img {
          margin-top: 10px;
          margin-right: 10px;
          height: 16px;
        }
      }
      .card-desc {
        flex: 1;
        font-size: 14px;
        line-height: 20px;
        .card-desc-list {
          display: flex;
        }
      }
      .card-btn {
        .img {
          width: 18px;
        }
      }
    }
    .card-info {
      // background: linear-gradient(-45deg, #3761ff, #3188ff);
      background: linear-gradient(180deg, #d9ebff, #f4f9ff, #ffffff);
      border-radius: 4px;
      display: flex;
      flex-wrap: wrap;
      position: relative;
      top: -4px;
      padding-top: 20px;
      .card-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 20%;
        padding-bottom: 12px;

        .card-item-img {
          width: 46px;
          margin-bottom: 6px;
        }
        .card-item-title {
          font-size: 12px;
          line-height: 18px;
          color: #4a4a4a;
        }
      }
    }
  }
}
.focus-con {
  margin: 0 10px;
  width: calc(100% - 20px);
  height: 62px;
  background: linear-gradient(90deg, #d9edff 0%, #ffffff 100%);
  border-radius: 4px;
}
</style>
